Method and apparatus for per session load balancing with improved load sharing in a packet switched network

ABSTRACT

Systems and methods for implementing per-session load balancing of packets that increase traffic sharing and reduce systematic unequal distribution of traffic are provided by virtue of one embodiment of the present invention. A method for operating a selected router is provided that uses a load balancing algorithm that is configured to de-correlate distribution of sessions among the active paths at the selected router relative to distributions of sessions of other algorithms at other routers of said network. Packets arriving at the selected router are assigned to an output path according to the load balancing algorithm. A method of routing a packet received at a router having an associated identifier is provided. The source address and a destination address of the packet are obtained. An output path is selected according to a load balancing algorithm that uses the associated identifier, the source address, and the destination address as inputs, and the packet is routed to the output interface associated with the selected output path. A look-up table that is configured using the identifier can be used in selecting the output path. A router storing an identifier assigned to the router is provided; the identifier is used in determining per-session routing of incoming packets.

The present invention relates to routing in a packet switched network.In particular, it relates to methods of performing session loadbalancing and reducing polarization effects.

In a packet switched network, each incoming packet at a router is sentto an output path, with the choice of output path made based oninformation at the router. (Where a packet has multiple destinations, itcan be routed to multiple output paths.) A divergent network is one inwhich there are multiple paths going through different routers for atleast one source-destination pair.

A packet is said to belong to a session. A session is a unidirectionalend-to-end IP communication between two IP nodes. All packets in asession have the same source IP address and the same destination IPaddress.

A destination IP prefix is a leading part of the destination IP address,typically denoting the network address; e.g., IP address 198.01.01.01can have a destination IP prefix of 198.01. Destination IP prefixes arecommonly used to make routing decisions, as known in the art of routing.For example, a table may be maintained showing possible output paths bydestination IP prefix.

At a router, an active path for a packet is a valid route to reach thedestination address of the packet, that is deemed to have an acceptablecost, as known in the art of routing. A path can be specified in termsof a next-hop IP address and output interface, as known in the art ofrouting. Load balancing at a router can be thought of as the ability toshare the traffic to a destination IP prefix over all active paths. Inthis application below, the terms “path” and “active path” are usedinterchangeably.

It is known to achieve near-perfect traffic sharing using per packetrouting, where a round-robin based scheme can be used to load balanceeach packet, and packets in the same session can follow different paths.However, this can result in packet reordering and non-predictive latencyfor a session, which are undesirable for some applications. Per sessionload balancing largely eliminates these disadvantages, as known in theart.

In per session load balancing, all packets from a session take the samepath from source to destination. Load balancing at a router is theability to share the traffic to a destination prefix over all the outputpaths of a router. That is, for a given destination IP address, loadsharing can be implemented by having the same number of sessionsassigned to each path active for that destination. In a router one ormore active paths to a given destination IP prefix may be assigned to anoutput interface of that router.

In per session load balancing, packets belonging to a session thatarrive at a router must consistently be routed to the path. It is knownto accomplish this via a hash function that depends only on the sourceaddress and destination address for a given number of active paths, andtherefore always gives the same result for a given source anddestination pair (“(S,D) pair”). The result is called the hash bin orhash result. The hash bin is mapped to a path. In prior art routers, thesame hash function is used in each router of a given model and/ormanufacturer of router, as described below.

The hash function is designed to evenly distribute the possible (S,D)pairs among the hash bins. For example, typically there can be 16 hashbins with values that are integers between 0 and 15, inclusive. If thereare two paths, 8 of the hash bins will be assigned to the first path and8 hash bins to the second path. This is typically accomplished byassigning even hash bins, i.e. hash bins in the set {0, 2, 4, 6, 8, 10,12, 14}, to the first path and odd hash bins to the second path, or viceversa. It is known to achieve uneven load sharing by assigning hash binsproportionally; for example, 3:1 load sharing between two paths can beaccomplished by assigning 12 hash bins to one path and 4 hash bins tothe second path.

Packet routing is by nature decentralized because packets are routed toa next-hop upon arrival at a router. Fast performance is needed becauseof increasing network traffic and demands for faster response time.Although prior systems are decentralized and fast, a problem is thatsystems including such routers implementing per session load balancingare observed to exhibit systematically unequal distribution of loadsharing. This is a problem among other reasons because links are notused efficiently.

Accordingly, it would be desirable to perform fast session loadbalancing that reduces systematic load imbalances presently observed. Itwould further be desirable if the system were decentralized and fineadjustments in load sharing could easily be achieved withoutreconfiguring the network topology.

SUMMARY OF THE INVENTION

Systems and methods for implementing per-session load balancing ofpackets that increase traffic sharing and reduce systematic unequaldistribution of traffic are provided by virtue of one embodiment of thepresent invention. A method for operating a selected router is providedthat uses a load balancing algorithm that is configured to de-correlatedistribution of sessions among the active paths at the selected routerrelative to distributions of sessions of other algorithms at otherrouters of said network. Packets arriving at the selected router areassigned to a path according to the load balancing algorithm. A methodof selecting a path for a packet received at a router having anassociated identifier is provided. The source address and a destinationaddress of the packet are obtained. An output path is selected accordingto a load balancing algorithm that uses the associated identifier, thesource address, and the destination address as inputs, and the packet issent to the output interface associated with that path. A look-up tablethat is configured using the identifier can be used in selecting theoutput path. A router storing an identifier assigned to the router isprovided; the identifier is used in determining per-session loadbalancing of incoming packets.

In one embodiment, a method for operating a selected router of anetwork, the router performing per-session load balancing, is provided.A load balancing algorithm is configured to reduce correlation ofdistribution of sessions among the active paths at the selected routerrelative to distributions of sessions of algorithms at other routers ofsaid network. Packets arriving at the selected router are assigned to apath according to the load balancing algorithm.

In one embodiment, a path is selected for a packet received at a routerhaving an associated identifier. A source address and a destinationaddress of the packet are obtained. An output path is selected accordingto a load balancing algorithm that uses the associated identifier, thesource address, and the destination address as inputs. The packet issent to the output interface associated with that path. A look-up tablethat is configured using the associated identifier can be used in thestep of selecting the output path.

In another embodiment, a router stores an identifier assigned to therouter. The identifier is used to help determine per-session loadbalancing of incoming packets. In one embodiment, the identifier isderived by seeding a random number generator with the IP address of therouter. In another embodiment, the identifier is set by a manufacturerof the router.

In yet another embodiment, an identifier is assigned to a router. An IPaddress of the router is obtained. A random number generator is seededwith the IP address. An output of the random number generator isassigned as an identifier of the router.

In yet another embodiment, a portion of a packet switched network isconfigured to reduce routing polarization. At least one router of aplurality of routers of a same model and/or a same manufacturer includedin a portion of a network is set to have a different load balancingalgorithm than another of the plurality of routers.

A further understanding of the nature and advantages of the inventionsherein may be realized by reference to the remaining portions of thespecification and the attached drawings.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 illustrates a network of multiple computer systems such as theInternet.

FIG. 2 shows a network including an embodiment of the invention.

FIG. 3 shows a sample hash bucket set-up to map a hash bin to a path fortwo through six paths.

FIG. 4 shows a network including an embodiment of the invention.

FIG. 5 is a process flow diagram illustrating load balancing accordingto an embodiment of the invention.

FIG. 6 is a schematic diagram of a router according to an embodiment ofthe invention.

FIG. 7 is a process flow diagram of assigning an identifier to a router.

FIG. 8 is a process flow diagram of assigning an identifier to a routerwith option to manually configure.

FIG. 9 is a process flow diagram of providing non-polarized loadbalancing throughout a network.

FIG. 10 is a process flow diagram of configuring a plurality ofconfigurable routers.

FIG. 11 is an initial hash table.

FIG. 12A is a sample table of shifts.

FIG. 12B is a sample table of shifts.

FIG. 13 is a process flow diagram of generating a randomized hash lookuptable from an initial hash table.

FIG. 14 is a schematic diagram of a router according to an embodiment ofthe invention.

DESCRIPTION OF SPECIFIC EMBODIMENTS

Embodiments of the invention are described below with reference tospecific processing systems and methods. However, embodiments of theinvention can be implemented in various ways. For example, aspects ofthe invention can be implemented in software or hardware or usingspecial purpose processors or by any other known mechanism. Therefore,the description of the embodiments that follows is for purposes ofillustration and not limitation.

Overview

A major problem observed in prior art networks is systematic overuse ofsome links and under-use of other links. A root cause of this flawedload sharing in prior art systems, revealed by careful examination, isthat load balancing of packets at different routers is highlycorrelated.

The distribution of sessions among output paths at one router iscorrelated with the distribution of sessions by load balancingalgorithms at other routers in prior art networks. In a divergentnetwork, such as the network shown in FIG. 2, sessions that are assignedto the same output path at the first router will tend to be groupedtogether by the load balancing algorithm at the second router. In thecase of two routers having the same number of output paths for a givendestination prefix, load balancing of packets with that destinationprefix is identical at each router. The specifics of how packets areload balanced in the prior art are described below.

Two load balancing algorithms can be said to be perfectly correlated,if, for a given set of sessions, and an equal number of output paths,the algorithms assign the same sessions to the same output paths. Seethe discussion of FIG. 2 below.

Correlated load balancing at routers that share traffic reduces loadsharing. When load balancing at adjacent routers is completelycorrelated, no load sharing of traffic arriving from the first routerwill occur at the second router. All packets arriving at the secondrouter from the first router will arrive at the second router by virtueof the load balancing algorithm at the first router assigning thepackets to same output path. At the second router, assuming perfectcorrelation with the load balancing of the first router, by definitionall packets will be assigned to a same output path. There is no loadsharing of the traffic from the first router at the second router.

As a concrete illustration, assume a first router has four paths for acertain destination prefix. Assume a certain packet is sent to outputpath #3 with next hop to a next router. Assume the next router also hasfour paths. Every packet received from the first router at this nextrouter, load balanced using the same load balancing algorithm, will besent to output path #3. No load sharing is achieved at the next router:output paths #1, #2, and #4 receive 0% of the traffic at issue.

An example of a hash function such as is used in the prior art to hashthe source and destination is shown in the following pseudo-code usingconventions of the C programming language. Many such hash function areknown in the art.hash=(dst^src) % N_(—)active

-   -   where ^ is a bitwise-XOR, src indicates the source IP address        and dst indicates the destination IP address. The hash is a        16-bit unsigned variable. The result is a value between 0 and        (N_(—)active-1), inclusive. N_(—)active is the number of hash        bins that are currently active. Referring to FIG. 3, which shows        a sample hash bucket setup for up to 16 bins, for npath=2 and 4,        N_(—)active is 16; for npath=3 and 5, N_(—)active is 15; and for        npath=6, N_(—)active is 12. The result returned is the hash bin        that is mapped to a path as known in the art; FIG. 3 shows a        table that can be used to do the mapping for two to six paths.        The entry in the table is the path to use. For example, for        Npath=6 and hash bin 10, path 4 should be used and N_(—)active        is 12 since hash buckets 12–15 are not used. For the hash        function shown, the hash function plus a mapping as in FIG. 3        make up the load balancing algorithm. Alternatively, N_(—)active        can be set to be the number of paths (equivalent to one hash bin        per path), in which case the result of the above pseudo-code        result can be the index of the output path or can be directly        mapped to an output path (in a 1:1 mapping).

As can be seen from examining the pseudo-code and FIG. 3, such a hashfunction uses as inputs only the source address, destination address,and the number of hash bins that are currently active. The number ofhash bins that are currently active depends on the number of paths. Fortwo routers having the same number of paths, the hash function dependsonly on the source address and the destination address.

Another way of understanding the problem is that prior art routers use ahash function that is designed to uniformly distribute the possiblesource-destination pairs among the hash bins (put an equal number of (S,D) pairs into each hash bin). For a large sample of random traffic, thiswill achieve load sharing. However, once a stream of traffic passesthrough a load balancing algorithm and is divided into sub-streams, eachof the sub-streams is not random with respect to the load balancingalgorithm, because the value of the load balancing algorithm is thebasis on which packets have been assigned to each sub-stream. Forexample, all the traffic that is assigned to hash bin 4 is in the samesub-stream. We say the traffic is polarized with respect to the loadbalancing algorithm. The load balancing algorithm will not distributesuch traffic evenly among paths. Polarization results in unequal loadsharing when such traffic again passes through a router employing theoriginal load balancing algorithm, or through a load balancing algorithmthat distributes traffic in a way that is correlated with distributionsof the original load balancing algorithm.

In the prior art, although routers can have different numbers of pathsand different weighting schemes that introduce some variation in theload balancing algorithms, load balancing algorithms at routers of asame model and/or manufacturer remain highly correlated because they usethe same hash function and so bin sessions together in a similar way.Traffic that has passed through one load balancing algorithm is whollyor partially polarized for another load balancing algorithm, andimperfect load sharing results.

In an actual network, routers typically have more than one inputinterface and various numbers of output interfaces, there is traffic formultiple destination addresses covering multiple destination prefixes,and there are complex interconnections among routers. This results in agreater mixture of factors which counterbalance to some degree thepolarizing effects of prior art routers.

The present invention provides a method for reducing polarizationeffects at a router and in a network as described below. In oneembodiment, the output path for an incoming packet is selected accordingto a load balancing algorithm that uses an identifier associated withthe router, the source address and the destination address of the packetas inputs. In this way, the load balancing algorithm can vary fromrouter to router and de-correlation of load balancing between routers inthe system can be achieved.

DETAILED DESCRIPTION

FIG. 1 shows a schematic drawing of a network of multiple computersystems. A network 101 provides communication between multiple computersystems 1. In an embodiment of the invention, such multiple computersystems 1 can act as a computer sending or receiving messages.

FIG. 2 shows a network including an embodiment of the invention. Thenetwork achieves per session load balancing. FIG. 2 includes routersR1–R7 201–207. Each router has one input interface 211–217. Each of therouters has two output interfaces. Each output interface has one activeoutput path, which is denoted for reference purposes as “+” for theinterface nearer the top of FIG. 2 and “−” for the interface nearer thebottom of FIG. 2.

Analyzing the traffic flow through routers R1 to R4 201–204 illustratesthe polarization effect. Each router R1 to R4 201–204 has the same loadbalancing algorithm H1(S,D). H1 takes as input a source address and adestination address, hashes them, and gives an integer result (hashbin); the hash function can be the one shown in pseudo-code above forexample. For example, there can be hash bins 0,1,2,3,4,5,6,7. Each hashbin is mapped to either “+” or “−”, and traffic is directed accordingly.For example, bins 0, 2, 4, and 6 can be mapped to “+” and odd bins 1, 3,5, and 7 to “−” for equal load sharing. At R1 traffic mapped to a “+” issent to R2: R2 receives traffic polarized in the “+” direction. At R2this traffic goes through H1 with the same “+” result and is sent to the“+” output interface. There is no sharing of the load at R2. Similarly,all traffic at R3 and R4 is routed to the “+” path.

In the portion of the network including R1, R5, R6 and R7 improved loadsharing is achieved. R1 sends the traffic having a “−” result to R5. R5has a load balancing algorithm H2(S,D) that has results that areuncorrelated with the results of H1 (S,D) and that is designed for equalload balancing. That is, the traffic arriving at R5 from R1 is notpolarized with regard to H2. Consequently, H2 splits the traffic evenlybetween the “+” and “−” paths. Similarly, at R7 the load balancingalgorithm H3 has results that are uncorrelated with both the results ofH1 as well as the results of H2, also shares traffic evenly between itstwo output paths. Load sharing is achieved at each of R1, R5, and R7.

However, router R6 uses the load balancing algorithm H1. Because all thetraffic into R5 is polarized as “−” by H1, the subset of that trafficsent to R6 is also polarized as “−” with regard to H1. So at R6 whereload balancing algorithm H1 is used, the traffic from R1 by way of R5 isrouted to the “−” path. However, the overall effects of trafficpolarization in routers R5–R7 are reduced compared to that in routersR2–R4 by introduction of the different load balancing algorithms H2 andH3.

A load balancing algorithm H2 that has results that are notsystematically related to the results of H1 can easily be created if H1is known by manually choosing H2 to be different from H1. Similarly, H3can be manually chosen to be different from H1 or H2 if H3 is known.Obviously the problem of manually setting very many load balancingalgorithms by referring to other load balancing algorithms in a networkrapidly grows unwieldy.

Another way to choose H2 and H3 is to use an appropriate load balancingalgorithm—for example the one shown in pseudo code above—withN_(—)active set to be a large number, such as 1000. The mapping fromhash bin to path can be done using a table similar to the one shown inFIG. 3, but having 1000 columns corresponding to the 1000 hash bins andhaving the entries in each row rearranged randomly. Such a system can beimplemented but is not preferred.

FIG. 4 shows a network including an embodiment of the invention. FIG. 4includes multiple routers R 401–407. Each router has a unique persession load balancing algorithm H1–H7 451–457 whose results are notcorrelated with those of any other load balancing algorithm in thenetwork. Therefore incoming traffic at a given router is not polarizedwith respect to the router's load balancing algorithm. In the networkshown, per-session load sharing is achieved.

It is cumbersome to assign a different hash function to each router bychecking the hash functions at all other routers and choosing one thatis different from, and preferably has results that are uncorrelatedwith, those of existing hash functions in a network. In a preferredembodiment, a load balancing algorithm is used that includes an inputparameter that is changed from router to router. In a preferredembodiment, the load balancing algorithm is designed so that the inputparameter has the effect of ensuring that the load balancing algorithmsemployed in the network are not correlated. In a preferred embodiment,the load balancing algorithm is adjusted by choosing a different valuefor the input parameter if it is found that the load balancing algorithmis not performing well.

A convenient and manageable way to include multiple load balancingalgorithms at routers in a network is to use a base load balancingalgorithm that is dependent on the source address, destination address,and a third parameter that we call the router identifier (“identifier”).Each router is assigned an identifier which in a preferred embodiment isunique in the network or nearly unique in the network. The identifiercauses the load balancing algorithm results to vary from router torouter. The base load balancing algorithm and identifier can be selectedso that load balancing at a router is not correlated with load balancingat other routers in a network. Details are described below.

FIG. 5 is a process flow diagram of load balancing a packet according toa preferred embodiment of the invention. A packet is received at arouter (not shown). At a step 510 the source address and destinationaddress, which are typically the IP addresses, are read. At a step 520 apath is selected according to an identifier-dependent load balancingalgorithm at the router, using the source address and destinationaddress. At a step 530 the packet is sent to an output interfaceassociated with the selected path.

In a preferred embodiment, the identifier-dependent load balancingalgorithm assigns sessions to paths in a manner that is notsystematically related to the distribution of sessions of other loadbalancing algorithms in the network. It is beneficial for the loadbalancing by the identifier-dependent load balancing algorithm at therouter to be uncorrelated or weakly correlated with load balancing ofload balancing algorithms that are used in nearby routers, becausetraffic is likely to flow from and to the router and nearby routers. Therouters can be manually tuned, for example as described below withreference to FIG. 8, when their load balancing performance is sub-par.

An example identifier-dependent base hash function for up to N_(—)activebins follows in pseudo-code using conventions of the C programminglanguage:

-   -   1hash=(dst^src^ident);    -   1hash=1hash^(1hash>>16);    -   1hash=1hash^(1hash>>8);    -   1hash=1hash^(1hash>>4);    -   return (1hash % N_(—)active);    -   where ^ is a bitwise-XOR, >>indicates a right-bitshift, src        indicates the source IP address and dst indicates the        destination IP address. The symbol “%” indicates a modulo        operator. The variable ident indicates the router's identifier        and N_(—)active is the number of hash bins that are active. The        result is the hash bin which then can be mapped onto a path as        known in the art. The variable 1hash is a 32-bit unsigned        variable.

The base hash function is generally stored in non-volatile memory in therouter. FIG. 6 shows a router according to an embodiment of theinvention. The router includes input interfaces 610 a–b and outputinterfaces 620 a–620 c which is coupled via a bus 650 to a centralprocessing unit 630 which includes non-volatile memory 640. Non-volatilememory 640 includes the identifier 643, a base hash algorithm 642, andIP address of the router 641. The router shown is but an example routerand other router architectures exist on which the present invention canbe implemented, including any router that load balances packets using aper session routing algorithm.

The base hash function shown above is but an example base hash function.

FIG. 7 is a process flow diagram for assigning an identifier to arouter. At a step 710 the IP address of the router is obtained, whichcan be done by reading it from memory or by any other known means. At astep 720 a random number generator is seeded with the IP address. It canbe seeded with the IP address, for example by interpreting it as a32-bit integer, or by any other transformation of the IP address into aseed. The random number generator (not shown in FIG. 6) can be includedin the memory 640 at a manufacture time, can be software that is loadedat a time of putting the router into service, or can be provided by anyother known methods. At a step 730 the first random number to begenerated is assigned to be the identifier, and in a preferredembodiment is written into memory 640. Because the IP address is fixed,the identifier can be recovered after failure or restart by repeatingthe process shown.

Alternately, the IP address, transformed into a number for example byinterpreting it as a 32-bit integer, can be used as the identifier.However, interconnected devices tend to have similar IP addresses, andso the hash functions generated are strongly correlated. Such correlatedhash functions improve load sharing somewhat; however, having a hashfunction that is uncorrelated or weakly correlated with nearby hashfunctions is preferred.

Alternately, identifiers can be assigned at a time of manufacture. Forexample, a manufacture can generate a sequence of random numbers andassign each router one of the numbers, for example by writing it intomemory or setting a hardware configuration or including writtendocumentation with the router. A manufacturer can alternately assignserial numbers to each router.

Alternatively, a centralized system can be used to assign an identifierat a set-up time or reboot time of a router. For example a centralizedsystem can provide the next random number in a sequence to a requestingrouter. (Also for example, a centralized system can have a plurality ofdifferent base hash functions and can select a base hash function by,e.g., random selection or by choosing one different from the base hashfunctions at adjacent routers.)

Alternatively, a router can communicate with each adjacent (next-hop)router and can choose an identifier that is different from each of them.(Also for example, if each router has a plurality of base hash functionsto select from it can alternatively communicate with adjacent routersand select a base hash function that is different from the base hashfunctions at adjacent routers. The base hash function can be one thathashes the source and destination addresses but does not include anidentifier parameter, or can be one that includes an identifierparameter.)

Tuning of a router can be accomplished by reconfiguring the router. Ifit is desirable to reconfigure the router, it can be accomplished asshown in the process flow diagram FIG. 8 which shows a process to assignan identifier with an option to manually configure. A random numbergenerator is seeded with the IP address of the router at a step 810. Ata decision step 820 it is decided whether user intervention is desired.User invention is usually not desired, but can be desired if previousload balancing performance of the router has been sub-par. If userintervention is not desired, the identifier is set to the first randomnumber at a step 830. If user invention is desired, it is determinedwhether the user desires to configure the identifier manually, and ifso, the process proceeds to a step 850 where the user enters theidentifier. If user intervention is not required, the next random numberin the series is generated at a step 860. The user is again queriedwhether he wishes to intervene at a step 870, and if not, the ID is setto be this second random-number at a step 880. If the user wishes tointervene at step 870, the process proceeds along a YES path to step 860and another random number is generated and the process continues to step870 until the result of decision step 870 is NO user intervention, atwhich time the process proceeds to step 880 and the ID is set to thecurrent random number.

Similarly, if multiple base hashing functions are available, then therouter can be reconfigured to use a different base hash function.

FIG. 9 is a process flow diagram for providing load balancing withreduced polarization in a network in a preferred embodiment. At a step910 each router is set to have a load balancing algorithm that producesload balancing where the distribution of source destination pairs israndomly set; preferably this is accomplished by using a load balancingalgorithm that includes an identifier parameter, and randomly selectinga value for the identifier, such as described above. This can beachieved, for example, by using the process of FIG. 7 to assign anidentifier and then using the identifier-dependent hash function shownabove together with a mapping to a path. At a step 920 a packet isreceived at a router, and at a step 930 the packet is load balancedaccording to the load balancing algorithm at the router. Steps 920–930are repeated until no packet remains unrouted at any router in thenetwork.

It is important to note that alternatively, at a step 910 the loadbalancing algorithm can be configured to load balance in a manner thatis de-correlated with routing at other routers in a network. In apreferred embodiment, this is done as described above by using a randomvalue as an input parameter to a load balancing algorithm. Alternativelya load balancing algorithm can be chosen randomly from a very largeselection of load balancing algorithms. Choosing randomly has thebenefit that the load balancing algorithm can be configured withoutreference to other routers in the network. However, in an alternativeembodiment where the load balancing algorithms at other routers areknown, such as other nearby routers, the load balancing algorithm canspecifically be chosen so that it load balances in a way that is notwell correlated or is uncorrelated with the load balancing at otherrouters.

FIG. 10 is a process flow diagram for configuring a plurality of routersto reduce polarization. At a step 1010 at least one configurable routeris set to have a different load balancing algorithm from a secondconfigurable router.

An alternate and fast way to implement a hash function and mappingincluding a randomizing factor (such as the identifier-dependent loadbalancing algorithm) is to use a randomized lookup table. Such arandomized lookup table is one example of an identifier-dependent loadbalancing algorithm. This can eliminate the use of multiply, modulo(which uses a divide operation), or other computationally expensiveoperations and provide better performance.

An example load balancing algorithm that can be used is shown here inpseudo-code using conventions of the C programming language:

-   -   hash=dst^src;    -   return        ((hash_(—)table[hash]>>hash_(—)table_(—)shifts[N_(—)active]) &        0xf);    -   where hash is a 16-bit unsigned variable. 0xf is a hexadecimal        number per standard C programming language conventions and is        the number 15 which is (2⁴−1) and can be represented by four        bits that all are on; performing the “&” operator between a        number and 0xf has the effect of obtaining the four least        significant bits of the number. Hash_(—)table and        hash_(—)table_(—)shifts are arrays, explained further next. In        one embodiment, hash_(—)table is a 2¹⁶ (65,536) entry table,        directly indexed by the result of the hash.        Hash_(—)table_(—)shifts is an array containing the shifts        necessary to obtain the 4-bits corresponding to the required        N_(—)active value.

An initial hash table is shown in FIG. 11. It has 2¹⁶ rows in oneembodiment. This is an arbitrary number, and it can be larger orsmaller. To randomize the table, the rows are rearranged in a randomorder (with entries in a row preserved). Each entry is 64-bits, whichcomprises 16 groups of 4 bits each, one group for each valid value ofN_(—)active (number of active hash bins), which in a preferredembodiment can be members of the set of integers from 1 to 16. For easeof reading, in FIG. 11 each group is shown in a separate box, so thateach time 1 appears it represents the four bits 0001, and each time 2appears it represents the four bits 0010, and 3 represents 0011, etc. asknown in the art.

Each group has a vertical column in the hash_(—)table, and the values inthat column represent the result of “entry” % “group number”, where %represents the modulo operator. For example, looking at the last row,entry 65,535, the right most value (group number 1) is 0, because 65535modulo 1 is 0. The value second to the right (group number 2) is 1,because 65535 modulo 2 is 1 (i.e. 65535 divided by 2 leaves a remainderof 1). The value third to the right (group number 3) is 0, because 65535modulo 3 is 0 (i.e. 65535 divided by 3 leaves a remainder of 0).

The sample array hash_(—)table_(—)shifts shown in FIG. 12A comprises 16entries, which are the shifts necessary to obtain the 4-bitscorresponding to the relevant 4 bits of the 64-bit entry inhash_(—)table, for the hash bin in question.

In one embodiment, a memory saving can be achieved by modifying the hashtable, such as the one shown in FIG. 11, to remove values that are notused. Specifically, some values of N_(—)active may not be used in agiven router. If for any reason a value of N_(—)active will not beneeded, columns corresponding to these values can be removed therebysaving memory space. For example, if a router only uses values forN_(—)active of 1, 12, 15 or 16, then all but the columns correspondingto these values can be removed, creating a table only 16-bits wide. Thehash_(—)table_(—)shifts is modified to provide shifts that correspond tothe columns remaining in the hash table. Since the unused N_(—)activevalues will not be used to index this array, the corresponding entriesin the hash_(—)table_(—)shifts can be set to any value. An examplehash_(—)table_(—)shifts array for the case where N_(—)active only hasvalues of 1, 12, 15 or 16 is shown in FIG. 12B.

A process flow diagram for shuffling the rows and generating arandomized hash lookup table is shown in FIG. 13. The operationsdescribed are on an initial hash table. At a step 1110 a random numbergenerator is seeded with a unique number, which in a preferredembodiment is the router's identifier. It can alternatively be the IPaddress of the router. A count variable is initialized also in step1110. At a step 1120 the next two numbers random numbers are obtainedfrom the random number generator. The two numbers are initiallyconstrained by parameters or mapped to be in the range [0, Nrow], asknown in the art of mathematics, where Nrow is (2¹⁶−1) for the examplebeing discussed. At a step 1130 the two rows associated with with therandom numbers are swapped. For example, if the two numbers are numbered16,543 and 798, then the values in row 16,543 and row 798 are swapped.At a decision step 1140 it is determined whether the desired number ofshuffles has been completed (131,070 in one embodiment) and if so, theprocess completes. If not, the process returns to step 1120 and the nexttwo number in the random number sequence are obtained. Note a randomnumber generator need not be used if an alternate means (such as adatabase) of random number exists and is accessible. This process flowdiagram achieves placing the rows of the initial hash table in a randomorder.

Both the number of rows as well as the number of shuffles are arbitrary.Either of them can be larger or smaller, and the performance of thenetwork or router observed to determine a minimum number of shuffles orminimum number of rows to obtain the desired degree of load sharing.Since the table is shuffled only at initialization time or when thealgorithm or identifier is changed, shuffling a large number of timesdoes not affect routine system performance.

FIG. 14 shows a router according to an embodiment of the invention. Therouter includes input interfaces 1310 a–b and output interfaces 1320a–1320 c which are coupled via a bus 1350 to a central processing unit1330 that includes non-volatile memory 1340. Non-volatile memory 1340stores the identifier 1343, a randomized hash lookup table 642, and theIP address of the router 641. The router shown is but an example routerand other router architectures exist on which the present invention canbe implemented, including any router that load balances packets using aper session load balancing algorithm.

While the above is a complete description of preferred embodiments ofthe invention, various alternatives, modifications, and equivalents canbe used. It should be evident that the invention is equally applicableby making appropriate modifications to the embodiments described above.For example, the flowcharts are exemplary embodiments but steps may beadded, deleted, combined, and reordered without departing from thespirit and scope of the invention. Creation of an identifier can beperformed at a time of manufacture or upon booting the router. It can bedone by generating it from information at the router without referringto any other router, by referring to a central database, randomly, or byany other known means. Therefore, the above description should not betaken as limiting the scope of the invention that is defined by themetes and bounds of the appended claims along with their full scope ofequivalents.

The foregoing describes embodiments of an invention that cansignificantly reduce unbalanced load sharing in a network that includesper-session load balancing. A hash function that can vary from router torouter is introduced. Routers of the invention preferably use a randomlychosen identifier that can be generated at the router, withoutcommunicating with other routers, to modify the hash function so thatload balancing algorithm results from various routers are de-correlatedfrom one another. As in prior art systems, unequal load balancing can beimplemented. A network can be fine-tuned by manually configuring arouter whose load-sharing performance is considered sub-par. Routersmanufactured according to an embodiment of the invention can be placedinto service in, and improve performance of, a network using prior artrouters.

1. A method for operating a selected router of a network, the routerperforming per-session load balancing where all packets of a session aresent over a same active path, the method comprising: configuring aper-session load balancing algorithm to reduce correlation ofdistribution of sessions among the active paths at the selected routerrelative to distributions of sessions among the active paths of saidper-session load balancing algorithm at other routers of said network;and assigning packets arriving at said selected router to a pathaccording to said per-session load balancing algorithm.
 2. A method asin claim 1 wherein the load balancing algorithm has multiple parametersand wherein configuring the load balancing algorithm includes steps of:selecting a random value; and setting one of the multiple parameters ofthe load balancing algorithm to be the random value.
 3. A method as inclaim 2 further including: monitoring the load balancing of packets forunacceptable performance; if there is unacceptable performance,reconfiguring the load balancing algorithm by setting the one of themultiple parameters to a different random value.
 4. A method as in claim1 further including: monitoring the load balancing of packets forunacceptable performance; if there is unacceptable performance,reconfiguring the load balancing algorithm by setting the one of themultiple parameters to a unique value.
 5. A method of load balancing apacket at a router using per-session load balancing comprising:receiving a packet at a router having an associated identifier;obtaining a source address and a destination address of the packet;selecting an output path according to a load balancing algorithm thatuses the associated identifier, the source address, and the destinationaddress as inputs, wherein selecting the output path includes using alook-up table that is configured using the associated identifier, thelook-up table being a randomized hash look-up table, wherein therandomized hash lookup table is configured by performing steps ofcreating an initial hash table having a plurality of rows, seeding arandom number generator with the associated identifier, obtaining a nextrandom number and another next random number from the random numbergenerator, swapping a row associated with the next random number and arow associated with the another next random number, and repeating thesteps of obtaining and swapping a preset number of times; and sendingthe packet to an output interface associated with the selected outputpath.
 6. A method for configuring a portion of a packet switched networkto reduce load balancing polarization comprising: selecting a routerfrom a plurality of routers of a same model included in a portion of anetwork, each of said plurality of routers having a same load balancingalgorithm; and setting said router to have a different load balancingalgorithm from another of the plurality of routers.
 7. A method forconfiguring a portion of a packet switched network to reduce loadbalancing polarization comprising: selecting a router from a pluralityof routers of a same manufacturer included in a portion of a network,each of said plurality of routers having a same load balancingalgorithm; and setting said router to have a different load balancingalgorithm from another of the plurality of routers.
 8. A system foroperating a selected router of a network by per-session load balancingwhere all packets of a session are sent over a same active path, themethod comprising: means for configuring a per-session load balancingalgorithm to de-correlate distribution of traffic among the active pathsat said selected router relative to distribution of traffic among theactive paths by said per-session load balancing algorithm at otherrouters of said network; and means for load balancing packets arrivingat said selected router according to said per-session load balancingalgorithm.
 9. A computer program product for operating a selected routerof a network, the router performing per-session routing where allpackets of the session are sent over a same active path, comprising:computer code that configures a per-session load balancing algorithm toreduce correlation of distribution of sessions among the active paths atthe selected router relative to distributions of sessions among theactive paths of said per-session load balancing algorithm at otherrouters of said network; and computer code that routes packets arrivingat said selected router according to said per-session load balancingalgorithm; and a computer readable medium that stores the computer code.10. The computer program product of claim 9, wherein the computerreadable medium is a CD-ROM, floppy disk, tape, flash memory, systemmemory, hard drive, or data signal embodied in a carrier wave.